#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
class A {
public:
	A(int x = 1) 
	:a(x){
		cout << "A(int x = 1)" << endl;
	}
	~A() {
		a = 0;
		cout << "~A()" << endl;
	}
private:
	int a;
};

template<class T>
T Add(const T& a,const T& b) {
	return a + b;
}
void p1() {
	int a = 1, b = 2;
	double x = 1.1, y = 2.2;
	cout << Add(a, b) << endl;
	cout << Add(x, y) << endl;
	cout << Add<int>(x, b) << endl;
	cout << Add<double>(x, b) << endl;
}
template<class T>
class B {
public:
	B(T a=4)
		:_a(new T[a])
		, size(0) {
		cout << "B(T a)" << endl;
	}
	~B() {
		delete[] _a;
		_a = nullptr;
		size = 0;
		cout << "~B()" << endl;
	}
private:
	T* _a;
	int size;
};
int main() {
	B<int>* a=new B<int>(5);
	delete a;
}